//
//  CYGLeftMenuChild.m
//  CYGHuntForCity
//
//  Created by cygarm on 16/3/2.
//  Copyright © 2016年 cygarm. All rights reserved.
//

#import "UIViewController+CYGLeftMenuChild.h"
#import "UIViewController+CYGNaviBar.h"

__weak UIViewController *cygLeftMenuChild_vc;
static NSString *cygLeftMenuChild_unwindSegueId;

@implementation UIViewController (CYGLeftMenuChild)

- (void)cyg_initLeftMenuChild:(UIViewController *)vc withUnwindSegueId:(NSString *)segueId {
	cygLeftMenuChild_vc = vc;
	[vc cyg_initNavigationBar:vc.navigationController.navigationBar];
	
	// 这里的图片由于像素不符,变形了
	// 1.自定义frame的button   2.imageInsets
	vc.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"artcleList_btn_info"] style:UIBarButtonItemStylePlain target:self action:@selector(MenuBtnClick:)];
	vc.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"search_icon"] style:UIBarButtonItemStylePlain target:self action:@selector(SearchBtnClick:)];
	vc.navigationItem.leftBarButtonItem.imageInsets = UIEdgeInsetsMake(4, 4, 4, 4);
	vc.navigationItem.rightBarButtonItem.imageInsets = UIEdgeInsetsMake(4, 4, 4, 4);
	
	if (segueId == nil) {
		segueId = @"seugeLeftMenuShowNaviUnwindHome";
	}
	cygLeftMenuChild_unwindSegueId = segueId;
}


#pragma mark - IBAction
- (IBAction)MenuBtnClick:(id)sender {
	[cygLeftMenuChild_vc performSegueWithIdentifier:cygLeftMenuChild_unwindSegueId sender:self];
}

- (IBAction)SearchBtnClick:(id)sender {
	
}
@end
